package com.autosalon.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * @author tomas
 *
 */
@Entity
@Table(name = "STAV_FINANCOVANI")
public class StavFinancovani implements Serializable, IModelClass{
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	
	@Column(name = "NAZEV_STAVU", nullable = false, length = 45)
	private String nazevStavu;
	
	@Column(name="DESCRIPTION", nullable=true, length=500)
	private String description;
	
	@OneToMany(cascade= CascadeType.ALL)
	@JoinColumn(name = "ID_STAV_FINANCOVANI")
	private List<Financovani> financovani;
	
	@Override
	public Long getId() {
		return id;
	}


	public String getNazevStavu() {
		return nazevStavu;
	}


	public void setNazevStavu(String nazevStavu) {
		this.nazevStavu = nazevStavu;
	}


	public List<Financovani> getFinancovani() {
		return financovani;
	}


	public void setFinancovani(List<Financovani> financovani) {
		this.financovani = financovani;
	}


	public String getDescription() {
		return description;
	}


	public void setDescription(String description) {
		this.description = description;
	}

        @Override
        public String toString() {
            return nazevStavu;
        }
	
}
